#ifndef udp_h
#define udp_h

#define unchar unsigned char
#define unint  unsigned int
#define unlong unsigned long

#define UDP_HEADER_LENGTH       8

/*
typedef struct
{
        unint  SourcePort;
        unint  DestPort;
        unchar LengthUpper;
        unchar Length;
        unint  Checksum;
        unchar Payload[1600];
}UDPDatagram;
*/

__packed typedef struct
{
        uint16  SourcePort;
        uint16  DestPort;
        uint8	LengthUpper;
        uint8	Length;
        uint16	Checksum;
        uint8	Payload[1600];
}UDPDatagram;

void UDP_Handler(UDPDatagram *udp);
//unint UDPCheckSum(unchar *Pseudo,unchar *Data, unint Size);
uint16 UDPCheckSum(uint8 *Pseudo,uint8 *Data, uint16 Size);
void UDPSendData(unchar *Payload,unint size);
void UDPReceive(void);
#endif
